window.onload = function() {
	var use = document.getElementById("use");
	var core=document.getElementById("core");
	
	use.onmousemove=function(){
		core.style.display="block";
	}
	core.onmousemove=function(){
		core.style.display="block";
	}
	use.onmouseout=function(){
		core.style.display="none";
	}
	core.onmouseout=function(){
		core.style.display="none";
	}
	
	var line=document.getElementById("line");
	var table = document.getElementById('table');	
	var tr = table.children[1].rows;		
	for(var i = 0; i < tr.length; i++) {
		tr[i].onclick = function(e) {
			var e = e || window.event;
			var el = e.target || e.srcElement; //通过事件对象的target属性获取触发元素
			var cls = el.className; //触发元素的class
			//通过判断触发元素的class确定用户点击了哪个元素
			switch(cls) {
				case 'delete': //点击了删除
					var conf = confirm('确定删除此商品吗？');
					if(conf) {
						this.parentNode.removeChild(this);
						line.style.display="none";
					}
					break;
			}
		}
	}
}